// 方式一
// 时间：72ms - 95.84%
var generate = function(numRows) {
  let ret = [];
  for (let index = 0; index < numRows; index++) {
    const prev = ret[ret.length - 1] || [];
    const next = generated(prev);
    ret.push(next);
  }
  return ret;
  function generated(array) {
    const ret = [1];
    for (let index = 0; index < array.length; index++) {
      const current = array[index];
      const next = array[index + 1] || 0;
      ret.push(current + next);
    }
    return ret;
  }
};
console.log(generate(32));
